package com.asimplefox.aasr;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

@Data
@Accessors(chain = true)
public class TokenInfo {
    private String refreshToken;
    private long expiresIn;
    private String sessionKey;
    private String accessToken;
    private String scope;
    private String sessionSecret;
    private Date expirationTime;

    // Constructor
    public TokenInfo(String refreshToken, long expiresIn, String sessionKey, String accessToken, String scope, String sessionSecret) {
        this.refreshToken = refreshToken;
        this.expiresIn = expiresIn;
        this.sessionKey = sessionKey;
        this.accessToken = accessToken;
        this.scope = scope;
        this.sessionSecret = sessionSecret;
        this.expirationTime = new Date(System.currentTimeMillis() + expiresIn * 1000);
    }

    // Method to check if the token is expired
    public boolean isTokenExpired() {
        return new Date().after(expirationTime);
    }
}